import permission from "@/common/utils/permission.js"
export default {
	data() {
		return {
			// "is_camera": -2,  // 判断相机权限
		}
	},
	methods: {
		async requestAndroidPermission(permissionID) {
			// #ifdef APP-PLUS
			if (uni.getSystemInfoSync().platform == 'ios') {
				return 1;
			} else {
				var result = await permission.requestAndroidPermission(permissionID)
				var strStatus
				if (result == 1) {
					strStatus = "已获得授权"
				} else if (result == 0) {
					strStatus = "未获得授权"
				} else {
					strStatus = "被永久拒绝权限"
				}
				return result;
			}
			// #endif
			
			// #ifndef APP-PLUS
			return 1;
			// #endif
		},
		async determineAndroidPermission(permissionID) {
			// #ifdef APP-PLUS
			if (uni.getSystemInfoSync().platform == 'ios') {
				// return 1;
			} else {
				var result = await permission.requestAndroidPermission(permissionID)
				var strStatus
				if (result == 1) {
					strStatus = "已获得授权"
				} else if (result == 0) {
					strStatus = "未获得授权"
				} else {
					strStatus = "被永久拒绝权限"
				}
				// this.is_camera = result;
				// console.log(this.is_camera);
				return result;
			}
			// #endif
		},
		openSetting() {
			// #ifdef APP-PLUS
			permission.gotoAppPermissionSetting()
			// #endif
		},
		judgmentPlatform() {
			return uni.getSystemInfoSync().platform
		},
	}
}